/*
 * Copyright (c) Citrix Systems, Inc.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 *   1) Redistributions of source code must retain the above copyright
 *      notice, this list of conditions and the following disclaimer.
 *
 *   2) Redistributions in binary form must reproduce the above
 *      copyright notice, this list of conditions and the following
 *      disclaimer in the documentation and/or other materials
 *      provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 * OF THE POSSIBILITY OF SUCH DAMAGE.
 */

package com.xensource.xenapi.samples;

import java.util.Map;

import com.xensource.xenapi.*;

/**
 * Retrieves and prints out records for all the available API objects.
 * This file is autogenerated.
 */
public class GetAllRecordsOfAllTypes extends TestBase
{
    public String getTestName() {
        return "GetAllRecordsOfAllTypes";
    }

    protected void TestCore() throws Exception
    {
        log("We'll try to retrieve all the records for all types of objects");
        log("This should exercise most of the marshalling code");

{{#api_class_records}}
        test{{api_class_record}}Records();
{{/api_class_records}}
    }

{{#api_class_records}}
    private void test{{api_class_record}}Records() throws Exception
    {
        announce("Get all the {{api_class_record}} records");
        Map<{{api_class_record}}, {{api_class_record}}.Record> allrecords = {{api_class_record}}.getAllRecords(connection);
        log("Got: " + allrecords.size() + " records");
        if (allrecords.size() > 0)
        {
            log("Printing out the first {{api_class_record}} record:");
            log(allrecords.values().toArray()[0].toString());
        }
        log("");
    }

{{/api_class_records}}
}
